<template>
	<view class="container">
		<view class="inp">
			<u--input
			    placeholder="请输入旧密码"
			    border="bottom"
			       clearable
			    v-model="old"
			   :password='true'
				:customStyle="customStyles"
			   placeholderStyle='color:#666'
			  ></u--input>
			  <u--input
			      placeholder="请输入新密码"
			      border="bottom"
			         clearable
					   :password='true'
			      v-model="new1"
				  :customStyle="customStyles"
			      placeholderStyle='color:#666'
			    ></u--input>
				<u--input
				    placeholder="确认密码"
				     border="bottom"
    clearable
	  :password='true'
	  :customStyle="customStyles"
					 placeholderStyle='color:#666'
				    v-model="new2"
				   
				  ></u--input>
		</view>
		<view class="btn">
			<u-button type="primary" text="确定" shape="circle"  color="#1890FF"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				old:'',
				new1:"",
				new2:'',
				customStyles:{
					height:'80rpx',
				}
			};
		},
		methods:{
			changepwd(){
				if(this.old==''){
					this.$toast('请输入旧密码')
					return false
				}
				if(this.new1==''){
					this.$toast('请输入新密码')
					return false
				}
				if(this.new2==''){
					this.$toast('请确认密码')
					return false
				}
				this.$changepwd({
					oldpassword:this.old,
					newpassword:this.new1,
					confirmpassword:this.new2
				}).then(res=>{
					this.$toast(res.msg)
					if(res.code==1){
						this.old=''
						this.new1=''
						this.new2=''
						uni.clearStorageSync()
						uni.redirectTo({
							url:"/pages/login/login"
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	background: #fff;
}
.container{
	.btn{
		padding: 120rpx 60rpx;
	}
}
</style>
